package com.zhuojy.equity.mall.admin.service.tExpenseAccount;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhuojy.equity.mall.admin.common.entity.po.TExpenseAccountPO;
import com.zhuojy.equity.mall.admin.common.pojo.JsonResult;
import com.zhuojy.equity.mall.admin.dal.mapper.tExpenseAccount.TExpenseAccountMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @Author:LYL
 * @Date 2024/3/31 19:32
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class TExpenseAccountService extends ServiceImpl<TExpenseAccountMapper, TExpenseAccountPO> {
    public JsonResult findExpenseAccountFenYe(TExpenseAccountPO tExpenseAccountPO, Integer pageNum, Integer pageSize) {
        Page<TExpenseAccountPO> page = new Page<>(pageNum, pageSize);
        IPage<TExpenseAccountPO> expenseAccountFenYe = this.baseMapper.findExpenseAccountFenYe(tExpenseAccountPO, page);
        return JsonResult.success(expenseAccountFenYe.getRecords(), expenseAccountFenYe.getTotal());
    }

    /**
     * @description:回显报销借款表
     * @author: lyl
     * @date: 2024/4/1 17:15
     * @param: id
     * @return: com.zhuojy.equity.mall.admin.common.entity.po.TExpenseAccountPO
     **/
    public TExpenseAccountPO findExpenseAccountById(Long id) {
        return this.baseMapper.findExpenseAccountById(id);
    }

    /**
     * @description:报销借款表状态修改
     * @author: lyl
     * @date: 2024/4/1 17:15
     * @param: tExpenseAccountPO
     **/
    public void updateExpenseAccountStatus(TExpenseAccountPO tExpenseAccountPO) {
        this.baseMapper.updateExpenseAccountStatus(tExpenseAccountPO);
    }

    public void addExpenseAccount(TExpenseAccountPO tExpenseAccountPO) {
        this.baseMapper.insert(tExpenseAccountPO);
    }
}
